/**
 * Copyright(c),2018-2018
 * FileName:  RoleController
 * Author:    旭哥
 * Date:      2018/10/21 15:20
 * Description:
 * History:
 * <author>  <time>  <version> <desc>
 ***/
package com.supply.supplymanage.controller;

import com.supply.supplymanage.biz.RoleBiz;
import com.supply.supplymanage.entity.Role_permission;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/role")
public class RoleController {
         @Resource
         private RoleBiz roleBiz;

         @RequestMapping("/queryRole")
         public @ResponseBody List<Map> queryRole(){
             List<Map> maps = roleBiz.queryRole();
             System.out.println(maps);
             return  maps;
         }

         @RequestMapping("/queryByQuan")
         public @ResponseBody Map queryByQuan(Integer roleid){
             System.out.println(roleid+"============================");
             //查看已授权
             List<Map> querybyQuan = roleBiz.querybyQuan(roleid);
             //查看未授权
             List<Map> maps = roleBiz.queryPer();
             Map m = new HashMap();
             m.put("querybyQuan",querybyQuan);
             m.put("maps",maps);
             return m;
         }

         @RequestMapping("/addRolePer")
         public @ResponseBody String addRolePer(Integer roleid,Integer perid){
              roleBiz.addRolePer(roleid, perid);
             return "true";

         }
}
